package cn.jsj.cxsys.pojo;

import org.jetbrains.annotations.*;

public class Record implements Comparable<Record>
{
    private int recordID;
    private String inTime;
    private String outTime;
    private Lab lab;
    private int computerNum;
    private User user;
    private String active;

    public int getRecordID() {
        return this.recordID;
    }

    public void setRecordID(final int recordID) {
        this.recordID = recordID;
    }

    public String getInTime() {
        return this.inTime;
    }

    public void setInTime(String inTime) {
        if (inTime == null) {
            this.inTime = inTime;
            return;
        }
        if (inTime.contains(".")) {
            inTime = inTime.substring(0, inTime.indexOf(46));
        }
        this.inTime = inTime;
    }

    public String getOutTime() {
        return this.outTime;
    }

    public void setOutTime(String outTime) {
        if (outTime == null) {
            this.outTime = outTime;
            return;
        }
        if (outTime.contains(".")) {
            outTime = outTime.substring(0, outTime.indexOf(46));
        }
        this.outTime = outTime;
    }

    public Lab getLab() {
        return this.lab;
    }

    public void setLab(final Lab lab) {
        this.lab = lab;
    }

    public int getComputerNum() {
        return this.computerNum;
    }

    public void setComputerNum(final int computerNum) {
        this.computerNum = computerNum;
    }

    public User getUser() {
        return this.user;
    }

    public void setUser(final User user) {
        this.user = user;
    }

    public String getActive() {
        return this.active;
    }

    public void setActive(final String active) {
        this.active = active;
    }

    public Record() {
        this.recordID = 0;
        this.inTime = null;
        this.outTime = null;
        this.lab = null;
        this.computerNum = -1;
        this.user = null;
        this.active = null;
    }

    @Override
    public String toString() {
        return this.getUser().getName();
    }

    @Override
    public int compareTo(@NotNull final Record o) {
        return o.getRecordID() - this.recordID;
    }
}
